Skip to content

[Version 11.0] Feature support for unsigned right shift operator - #1595

Draft
RexJaeschke wants to merge 8 commits into
draft-v11from
v11-unsigned-right-shift-operator
Draft

RexJaeschke wants to merge 8 commits into
draft-v11from
v11-unsigned-right-shift-operator

Conversation

@RexJaeschke

Copy link
Copy Markdown
Contributor

This is Rex's adaptation of the corresponding MS proposal.

@RexJaeschke RexJaeschke added this to the C# 11 milestone Mar 6, 2026
@RexJaeschke RexJaeschke added type: feature This issue describes a new feature Review: pending Proposal is available for review labels Mar 6, 2026
@RexJaeschke
RexJaeschke marked this pull request as draft March 6, 2026 15:46
Comment thread standard/expressions.md Outdated
For an operation of the form `x << count` or `x >> count`, binary operator overload resolution ([§12.4.5](expressions.md#1245-binary-operator-overload-resolution)) is applied to select a specific operator implementation. The operands are converted to the parameter types of the selected operator, and the type of the result is the return type of the operator.
Dynamic binding uses values of type `enum System.Linq.Expressions.ExpressionType` to communicate binary operator kind to the runtime binder. As there is no enum member specifically representing an unsigned right shift operator, dynamic binding for `>>>` is not supported.

For an operation of the form `x << count`, `x >> count`, or `X >>> count`, binary operator overload resolution ([§12.4.5](expressions.md#1245-binary-operator-overload-resolution)) is applied to select a specific operator implementation. The left operand is converted to type `T`, where `T` is the first of `int`, `uint`, `long`, and `ulong` that can fully represent all possible values of the operand. The operation is then performed using the precision of type `T`, and the type of the result is `T`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should nint and nuint be included here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. This is the integer-promotion rule; predefined >>> operators on nint/nuint (already listed) match directly when the operand is nint/nuint. Promotion targets stay int/uint/long/ulong because those cannot uniformly "fully represent" platform-sized nint/nuint. Text is consistent with the rule used for <</>>.

@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch from e619ed7 to 1d55409 Compare April 29, 2026 19:48
@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch from 1d7001e to cf99eec Compare May 13, 2026 16:36
@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch from cf99eec to 69a738b Compare June 24, 2026 20:16
@BillWagner

Copy link
Copy Markdown
Member

An earlier version of this feature is already present on v11-alpha from a prior meeting. Edits made to this PR since then are not yet on v11-alpha; they will land at the next propagation. If you need them on v11-alpha sooner, please open a separate PR targeting v11-alpha.
Thanks!

@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch from 69a738b to a470ab5 Compare July 24, 2026 19:57
@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch 4 times, most recently from 7e9bc5d to 5b7e170 Compare September 21, 2026 19:20
@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch from 5b7e170 to ed7c7bb Compare October 14, 2026 18:11
BillWagner added a commit that referenced this pull request Oct 14, 2026
[Version 11.0] Feature support for unsigned right shift operator
Authoritative source v11-unsigned-right-shift-operator 5b7e170; reviewed-source replay ed7c7bb.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
RexJaeschke and others added 7 commits November 12, 2026 16:08
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Update some of the grammar, and a few normative rules

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 21570b74-c6f5-4fc5-ab6d-7546918d6ddb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
@BillWagner
BillWagner force-pushed the v11-unsigned-right-shift-operator branch from 1b13b7b to 986cfe1 Compare November 12, 2026 23:37
BillWagner added a commit that referenced this pull request Nov 12, 2026
Preserve current committee source and genuine feature additions; resolve the recorded mechanical source overlap.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 361b9a77-2b4c-45e6-969f-e6785c47f27e
Update text to include the fact that the right shift production may include 3 adjacent required tokens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: pending Proposal is available for review type: feature This issue describes a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants